export const _isMobile = () => {
    let flag = navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)
    return flag;
}

export function copyText(data) {
    let oInput = document.createElement('input');
    oInput.value = data;
    document.body.appendChild(oInput);
    oInput.select(); // 选择对象;
    document.execCommand("Copy"); // 执行浏览器复制命令
    this.$message.success('复制成功')
    oInput.remove()
    
}

let  langCli = function (language,cb){
  this.$i18n.locale = language;
  localStorage.setItem('languageSet',language)
  cb && cb()
}

export const handleHref = (pathParams, href = 'https://tronscan.io/#/address/') => {
  return window.open(href + pathParams, '_blank');
}

export let config = "https://newbest.io/newbest";

if (process.env.NODE_ENV === "development") {
  config = "http://192.168.1.100/newbest";
} else {
  config = "https://newbest.io/newbest";
}
let homeConfig='https://newbest.io'
let aderssVal = 'TErebSw3T6ASNtwHTM3YVqQoepH3AgSKqw';
//16转10进制
let zhuan10 = function (num){
  return parseInt(num,16)
};
let accMul = function accMul(arg1, arg2) {
  var m = 0, s1 = arg1.toString(), s2 = arg2.toString();
  try { m += s1.split(".")[1].length } catch (e) { }
  try { m += s2.split(".")[1].length } catch (e) { }
  return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m)
}
export default {
    config,
    isMobile:_isMobile,
    langCli,
    handleHref,
    aderssVal,
    zhuan10,
    homeConfig,
    accMul
  }